<?php 
$pdo=new PDO("mysql:host=127.0.0.1;dbname=test",'root','root');

$sql="select * from y_list";
$data=$pdo->query($sql)->fetchAll();
 ?>
 <!DOCTYPE html>
 <html lang="en">
 <head>
 	<meta charset="UTF-8">
 	<title>Document</title>
 	<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
 	<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdn.bootcss.com/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://cdn.bootcss.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
 </head>
 <body>
 	<table class="table">
  <thead>
    <tr>
      <th scope="col">序号</th>
      <th scope="col">姓名</th>
      <th scope="col">薪资</th>
      <th scope="col">职位</th>
      <th scope="col">年龄</th>
      <th scope="col">操作</th>
    </tr>
  </thead>
  <?php foreach ($data as $key => $value) :?>
  <tbody>
    <tr>
      <th scope="row"><?=$value['id']?></th>
      <td><?=$value['yname']?></td>
      <td><?=$value['ypay']?></td>
      <td><?=$value['ypost']?></td>
      <td><?=$value['yage']?></td>
      <td><a href="">删除</a></td>
    </tr>
  </tbody>
<?php endforeach ?>
</table>
 </body>
 </html>